package cn.iocoder.yudao.module.mini.dal.mysql.opinion;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mini.dal.dataobject.opinion.OpinionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mini.controller.admin.opinion.vo.*;

/**
 * 意见反馈 Mapper
 *
 * @author dzy
 */
@Mapper
public interface OpinionMapper extends BaseMapperX<OpinionDO> {

    default PageResult<OpinionDO> selectPage(OpinionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OpinionDO>()
                .eqIfPresent(OpinionDO::getContent, reqVO.getContent())
                .eqIfPresent(OpinionDO::getImgUrl, reqVO.getImgUrl())
                .eqIfPresent(OpinionDO::getMobile, reqVO.getMobile())
                .betweenIfPresent(OpinionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OpinionDO::getId));
    }

    default List<OpinionDO> selectList(OpinionExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<OpinionDO>()
                .eqIfPresent(OpinionDO::getContent, reqVO.getContent())
                .eqIfPresent(OpinionDO::getImgUrl, reqVO.getImgUrl())
                .eqIfPresent(OpinionDO::getMobile, reqVO.getMobile())
                .betweenIfPresent(OpinionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OpinionDO::getId));
    }

}
